using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NTTHAO.CommonWeb;
using NTTHAO.Web.BL.CommonPage;

public partial class Sites_ThanhDuy_Webparts_Common_NewsDetail : NTTHAO.CommonWeb.CommonUserControl
{
    public static readonly int PAGE_SIZE = 4;

    public CommonPageGroup _Group = null;
    public CommonMenu _Menu = null;
    public CommonPageContent _Content = null;
    public DataTable _List = null;

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            _Group = this.GetCurrentPageGroup();
            _Content = this.GetCurrentContent();
            if (_Content == null)
            {
                _Menu = this.GetCurrentMenu();
            }
            else
            {
                _Menu = CommonMenu.GetCommonMenu(_Content.MenuID);

                long _TotalItem = 0;
                DataSet ds = CommonPageContent.GetPageByMenuID(_Menu.ID, 1, true, _Content.ID, ContentSortTypes.InsertTimeDecrease, 1, PAGE_SIZE, ref _TotalItem);
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    _List = ds.Tables[0];
                }
            }
        }
        catch { }

        if (_Content != null)
        {
            this.Session["PAGE_TITLE"] = _Content.Header.Replace(Environment.NewLine, "").Replace("\"", "'");
            this.Session["PAGE_DESCRIPTION"] = NTTHAO.CommonWeb.WebGlobal.GetPlainText(_Content.Description).Replace("\"", "'").Replace(Environment.NewLine, "");
        }
    }

    public string GetURL(string menuPath, int contentID, string contentURLText)
    {
        return "/" + _Group.URLName + "/" + CommonMenu.GetUrlPath(menuPath) + "/" + contentURLText + "_" + contentID.ToString() + ".html";
    }
}
